<template>
  <van-sticky>
    <van-nav-bar
      :title="title"
      :left-text="leftText"
      :right-text="rightText"
      :fixed="fixed"
      :border="false"
      z-index="100"
      @click-left="onClickLeft"
      @click-right="onClickRight"
    >
      <template #left>
        <v-back />
      </template>
    </van-nav-bar>
  </van-sticky>
</template>

<script>
export default {
  name: "v-nav",
  emits: ["clickRight"],
  props: {
    title: {
      type: String,
    },
    leftText: {
      type: String,
    },
    rightText: {
      type: String,
    },
    fixed: {
      type: Boolean,
    },
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    },
    onClickRight() {
      this.emit("clickRight");
    },
  },
};
</script>